package Week3.num.week3Test1.Level4_Project6;

public class Rectangle {
    /**
     * 矩形的长
     */
    private int length;
    /**
     * 矩形的宽
     */
    private int width;

    /**
     * 矩形的空参构造
     */
    public Rectangle() {
    }

    /**
     * 矩形的全参构造
     * @param length 矩形的长
     * @param width 矩形的宽
     */
    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
    }

    /**
     * get和set方法
     */
    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }
    public int getArea(){
        return length*width;
    }
    public int getPer(){
        return length*width;
    }

    /**
     * 展示所有属性的值
     */
    public void showAll(){
        System.out.println("长"+getLength());
        System.out.println("宽"+getWidth());
        System.out.println("面积"+getArea());
        System.out.println("周长"+getPer());
    }
}
